import os
import tools.tools

dir_path = os.path.split(__file__)[0]
tool = tools.tools.Tools()


def merge_file():
    """
    合并文件
    :return:
    """
    file_path = dir_path.replace('function', 'data\\ud_mt')
    files_name = os.listdir(file_path)
    files = [os.path.join(file_path, file_name) for file_name in files_name]

    data_list = []
    for file in files:
        data_list.extend(tool.yaml_load(file))
    tool.yaml_dump(dir_path.replace('function', 'data\\ud_mt.yaml'), data_list)


if __name__ == "__main__":
    merge_file()
